package com.appwoo.txtws.service;

import android.content.Context;
import com.appwoo.android.exception.NotFoundNetWorkException;
import com.appwoo.android.exception.TimeOutException;
import com.appwoo.txtws.bean.PhoneBean;
import com.appwoo.txtws.bean.StateBean;
import com.appwoo.txtws.component.Global;
import com.appwoo.txtws.component.PhoneHelper;
import java.io.IOException;
import java.util.ArrayList;
import org.xmlpull.v1.XmlPullParserException;

public class RQFamilyPhone
{
  private Context context;
  private LoginService loginService;

  public RQFamilyPhone(Context paramContext)
  {
    this.context = paramContext;
    this.loginService = new LoginService();
  }

  public StateBean addPhones(ArrayList<PhoneBean> paramArrayList, String paramString)
  {
    Object localObject = null;
    try
    {
      localObject = this.loginService.addPhoneList(paramString, paramArrayList, this.context);
      if (localObject == null)
      {
        StateBean localStateBean = new StateBean();
        localObject = localStateBean;
      }
      return localObject;
    }
    catch (IOException localIOException)
    {
      localIOException.printStackTrace();
      return localObject;
    }
    catch (XmlPullParserException localXmlPullParserException)
    {
      localXmlPullParserException.printStackTrace();
      return localObject;
    }
    catch (TimeOutException localTimeOutException)
    {
      localTimeOutException.printStackTrace();
      return localObject;
    }
    catch (NotFoundNetWorkException localNotFoundNetWorkException)
    {
      localNotFoundNetWorkException.printStackTrace();
    }
    return localObject;
  }

  public StateBean delPhones(ArrayList<PhoneBean> paramArrayList, String paramString)
  {
    try
    {
      StateBean localStateBean = this.loginService.delPhoneList(paramString, paramArrayList, this.context);
      return localStateBean;
    }
    catch (IOException localIOException)
    {
      localIOException.printStackTrace();
      return null;
    }
    catch (XmlPullParserException localXmlPullParserException)
    {
      localXmlPullParserException.printStackTrace();
      return null;
    }
    catch (TimeOutException localTimeOutException)
    {
      localTimeOutException.printStackTrace();
      return null;
    }
    catch (NotFoundNetWorkException localNotFoundNetWorkException)
    {
      localNotFoundNetWorkException.printStackTrace();
    }
    return null;
  }

  public ArrayList<PhoneBean> getJJPhone()
  {
    return new PhoneHelper(this.context).getPhoneList("紧急");
  }

  public ArrayList<PhoneBean> getQQPhone()
  {
    ArrayList localArrayList = new PhoneHelper(this.context).getPhoneList("亲情");
    for (int i = 0; ; i++)
    {
      if (i >= localArrayList.size())
        return localArrayList;
      ((PhoneBean)localArrayList.get(i)).getPname();
    }
  }

  public void insertLocal()
  {
    PhoneHelper localPhoneHelper = new PhoneHelper(this.context);
    ArrayList localArrayList1 = new ArrayList();
    ArrayList localArrayList2 = new ArrayList();
    ArrayList localArrayList3 = new ArrayList();
    if (Global.PARENT_ID != null)
      localArrayList1 = rqPhones(Global.PARENT_ID, "1900-01-01 00:00:00");
    if (localArrayList1 == null)
      localArrayList1 = new ArrayList();
    int i = localArrayList1.size();
    int j;
    if (i > 0)
    {
      j = 0;
      if (j < i)
        break label113;
      if (localArrayList3.size() > 0)
        localPhoneHelper.addPhones(localArrayList3);
      if (localArrayList2.size() > 0)
        localPhoneHelper.updatePhones(localArrayList2);
    }
    return;
    label113: PhoneBean localPhoneBean = (PhoneBean)localArrayList1.get(j);
    if (((PhoneBean)localArrayList1.get(j)).getIsdel().equals("0"))
      localArrayList3.add(localPhoneBean);
    while (true)
    {
      j++;
      break;
      localArrayList2.add(localPhoneBean);
    }
  }

  public void insertLocal(ArrayList<PhoneBean> paramArrayList)
  {
    PhoneHelper localPhoneHelper = new PhoneHelper(this.context);
    ArrayList localArrayList1 = new ArrayList();
    ArrayList localArrayList2 = new ArrayList();
    if (paramArrayList == null)
      paramArrayList = new ArrayList();
    int i = paramArrayList.size();
    int j;
    if (i > 0)
    {
      j = 0;
      if (j < i)
        break label89;
      if (localArrayList2.size() > 0)
        localPhoneHelper.addPhones(localArrayList2);
      if (localArrayList1.size() > 0)
        localPhoneHelper.updatePhones(localArrayList1);
    }
    return;
    label89: PhoneBean localPhoneBean = (PhoneBean)paramArrayList.get(j);
    if (((PhoneBean)paramArrayList.get(j)).getIsdel().equals("0"))
      localArrayList2.add(localPhoneBean);
    while (true)
    {
      j++;
      break;
      localArrayList1.add(localPhoneBean);
    }
  }

  public ArrayList<PhoneBean> rqPhones(String paramString1, String paramString2)
  {
    try
    {
      ArrayList localArrayList = this.loginService.getPhoneList(paramString1, paramString2, this.context);
      return localArrayList;
    }
    catch (IOException localIOException)
    {
      localIOException.printStackTrace();
      return null;
    }
    catch (XmlPullParserException localXmlPullParserException)
    {
      localXmlPullParserException.printStackTrace();
      return null;
    }
    catch (TimeOutException localTimeOutException)
    {
      localTimeOutException.printStackTrace();
      return null;
    }
    catch (NotFoundNetWorkException localNotFoundNetWorkException)
    {
      localNotFoundNetWorkException.printStackTrace();
    }
    return null;
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.appwoo.txtws.service.RQFamilyPhone
 * JD-Core Version:    0.6.2
 */